import java.util.Scanner;


public class Game {

	public static int M;
	public static int N;
	public static int[][] table;
	public static int applesNum = 0;
	
	static Scanner input = new Scanner(System.in);
	public static void main(String[] args){
		System.out.print("Enter the columns: ");
		M = input.nextInt();
		System.out.print("Enter the rows: ");
		N = input.nextInt();
		System.out.println("--------------------------------");
		createTable(M,N);
		//System.out.println("Player 1");
		Player p1 = new Player(M, 0, 0, table);
		//System.out.println("Player 2");
		Player p2 = new Player(N, M-1, N-1, table);
		System.out.println("--------------------------------");
		displayScreen(table);
		System.out.println("--------------------------------");
		System.out.println(applesNum+"/"+p1.score+"/"+p2.score);
	}
	
	public static void createTable(int M, int N){
		table = new int[M][N];
		for(int i=0;i<table.length;i++){
			for(int k=0;k<table[0].length;k++){
				int apple = (int) (Math.random()*(M+1));
				if(apple > 0){
					table[i][k] = apple;
					applesNum += apple;
				}
				if(apple < 10){
					System.out.print("| " + table[i][k] + " ");
				}else{
					System.out.print("| " + table[i][k]);
				}
			}
			System.out.print("|");
			System.out.println();
		}
	}
	
	private static void displayScreen(int[][] table){
		for(int i=0;i<table.length;i++){
			for(int k=0;k<table[0].length;k++){
				if(table[i][k] < 10){
					System.out.print("| " + table[i][k] + " ");
				}else{
					System.out.print("| " + table[i][k]);
				}
			}
			System.out.print("|");
			System.out.println();
		}
	}
	
}
